package com.ftwj.demo.modular.service;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.http.client.HttpClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.response.UpdateResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ftwj.demo.config.solr.PageInfoBean;
import com.ftwj.demo.config.solr.SolrUtil;
import com.ftwj.demo.modular.entity.SolrBean;
import com.ftwj.demo.utils.logs.LoggerUtil;
import com.github.qcloudsms.httpclient.HTTPClient;

@Service
public class SolrService {
	
	@Autowired
	private SolrUtil<SolrBean> solr;
	
//	private static HttpSolrClient solrClient = new HttpSolrClient.Builder("http://root:root@47.104.153.195:8983/solr/feitian").build();
//	
//	private static SolrQuery solrQuery = new SolrQuery();
	
	public void load(){
		HttpClient httpClient = solr.load();
	}

	public boolean insert(SolrBean solrBean) {
		boolean flag = false;
		try {
			solr.addBean(solrBean);
			flag = true;
		} catch (SolrServerException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return flag;
	}

}
